home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
t_os
/
gpen32k
/
source.exe
/
LIB
/
OSRC
/
TIFFSAVE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-04
|
949b
|
54 lines
/* Tiff File saver */
#include <stdio.h>
#include <stdlib.h>
#include <egb.h>
#include <tifflib.h>
#include <okome.h>
#include <normlib.h>
extern char b[];
static xx, xx2, yy;
static FILE *fp;
int tifo( char *buf, long sz )
{
fwrite(buf, 1, sz, fp);
return (0);
}
int tifgv( char *buf, int ofs, int lines)
{
egbget(xx,yy+ofs,xx2,yy+ofs+lines-1,buf);
return (0);
}
int tiffsave( char *na, int x1, int y1, int x2, int y2, int z, int p )
{
char im[2048], fo[4096], hd[4096];
int x4, i;
x4 = x2-x1+1;
xx = x1;
xx2 = x2;
yy = y1;
if ((fp = fopen(na,"wb"))==NULL)
return (-1);
fseek(fp,512,SEEK_SET);
TIFF_setSaveFunc(tifo,tifgv);
if (z==0)
{
z = 1;
} else {
z = 5;
}
i = TIFF_saveImage(16,x4,y2-y1+1, z, fo, 4096,im,x4,1024/x4,b);
fseek(fp,0,SEEK_SET);
if (z==1)
{ i = 0; }
TIFF_setHead(hd, 16, x4, y2-y1+1, i, im);
fwrite(hd, 1,512,fp);
fclose(fp);
return (0);
}